home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / ntscboot / NTSCboot.asm next >
Assembly Source File  |  1990-03-15  |  3KB  |  70 lines

  1. X;
  2. X; NTSCBoot.asm
  3. X;
  4. X; Copyright (C) 1990 By Udi Finkelstein.
  5. X; 17 feb 1990
  6. X;
  7. X; Reboot a SuperAgnus equipped PAL machine into NTSC mode.
  8. X;
  9. X; With thanks to Bart Whitebrook from CBM for his article on the new ECS
  10. X; registers in the 3rd european DevCon notes!
  11. X
  12. X; get into supervisor state, since we can only execute RESET there.
  13. X       xref    _LVOSuperState
  14. X       move.l  4,a6
  15. X       jsr     _LVOSuperState(a6)
  16. X
  17. X; ************************************
  18. X; Warning!!! a grand hack ahead!!!!!!!
  19. X; Never do this stuff alone at home!!!
  20. X; ************************************
  21. X
  22. X; Now we are in supervisor mode, and can issue a RESET command.
  23. X; Unfortunately, after RESET there is no RAM in the system!
  24. X; We can issue exacly *one* instruction ( 1 word length ) because
  25. X; the instruction was fetched before RESET was executed. This
  26. X; instruction can be a 'jmp (aX)', to somewhere on the ROM, where the
  27. X; program can continue. After searching the Kickstart 1.3 ROM, I found
  28. X; that at address $ff4120 you can find the code:
  29. X
  30. X; [ Notice - for Kickstart 1.3 ***ONLY***!!! Is there anybody out there
  31. X;   with a Kickstart 1.2/super Agnus combination? you have a problem! ;-) ]
  32. X
  33. X;00FF4120 2741 0038              move.l  d1,$38(a3)
  34. X;00FF4124 4281                   clr.l   d1
  35. X;00FF4126 4ED6                   jmp     (a6)
  36. X
  37. X; We can use this code fragment to set the NTSC bit in the super agnus,
  38. X; and then jump to the reset code. The PAL/NTSC bit is contained in
  39. X; address $DFF1DC   (BEAMCON0 !).
  40. X;
  41. X; 'move.l d1,$38(a3)' writes a longword, therefor $38(a3) must point to
  42. X; $dff1da because it's a read only location, which we can't harm, and
  43. X; $dff1dc contains the PAL/NTSC bit.
  44. X; $38(a3) == $dff1da   -->  a3 == $ddf1a2
  45. X; we must reset d1 ofcourse, or set d1 == #$00000020 to set PAL mode.
  46. X;
  47. X; ofcourse we have to set a6 to $00000002 to run the reset code later.
  48. X;
  49. X
  50. XROMADR =       ($ff4120-$fc0000)
  51. X
  52. X; ROMADR points to $ff4120 after the ROM appears in address $0000.
  53. X
  54. X       lea.l   $dff1a2,a3
  55. X       move.l  #$0,d1
  56. X       move.l  2,a6
  57. X       cnop    0,4
  58. X       lea.l   ROMADR,a5
  59. X       RESET                   ;reset the machine...
  60. X       jmp     (a5)            ;execute our code fragment.
  61. X
  62. X; Well, that's it. I tried writing a more portable code by trying to
  63. X; set/reset the OVL bit in $BFE001 instead of 'jmp (aX)' after RESET,
  64. X; but I wasn't able to get it working, so the only way I found to run
  65. X; a code after RESET is to find a ROM fragment that happenes to match
  66. X; my requirement. You don't have to tell me how bad it is. Hopefully,
  67. X; the 1.4 preferences will have a PAL/NTSC software switch ( Will it?!!)
  68. X
  69. X       END
  70.